// @algorithm @lc id=100280 lang=cpp
// @title ti-huan-kong-ge-lcof

#include "algm/algm.h"
#include <iostream>
#include <string>
#include <vector>
using namespace std;
class Solution {
public:
    string replaceSpace(string s) {
        string ans;
        string sub = "%20";
        int n = s.length();
        if (n == 0) {
            return ans;
        }
        for (int i = 0; i < n; ++i) {
            if (s[i] == ' ') {
                ans += sub;
            }
            else {
                ans.push_back(s[i]);
            }
        }
        return ans;
    }
};